<template>
    <div>
        登录页
        <h2>Router路由实例对象的push方法和replace方法</h2>
        <button @click="handlePushClick">push方法跳转到商品页</button>
        <br />
        <button @click="handleReplaceCLick">replace方法跳转到商品页</button>
    </div>
</template>
<script setup>
import { useRouter } from 'vue-router'

//路由实例
const router = useRouter()

const handlePushClick = () => {
    //点击跳转到商品页面
    router.push({
        // query路由传参
        path:'/goods',//跳转到目标路由
        query:{
            id:'120'
        }
        
        // params传参
        // name:'goods',
        // params:{
        //     id:'120'
        // }
    })
}

const handleReplaceCLick = () =>{
    router.replace({
        path:'/goods'
    })
}
</script>
<style scoped></style>